package com.eastseeway.radioproject.entities;

import androidx.annotation.Keep;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

import struct.StructClass;
import struct.StructField;
@Keep
@StructClass
public class BeanToBottomBoard {

    /*
    typedef enum
    {
        cmd_bottombrd_Vbus_Set = 1, //Android主板对底板Vbus电压进行设置命令，其后2字节为(uint16_t)Vbus预设电压值(3-30V)*100(保留2位小数，放大100倍)
        cmd_bottombrd_Power_On_Negative_Press_Board,//给负压板上电
        cmd_bottombrd_Power_Off_Negative_Press_Board,//给负压板断电
        cmd_bottombrd_Power_On_Bizzer, //给蜂鸣器上电
        cmd_bottombrd_Power_Off_Bizzer,//给蜂鸣器断电
        cmd_bottombrd_Button_LED1_On,  //给按键板LED1上电
        cmd_bottombrd_Button_LED1_Off, //给按键板LED1断电
        cmd_bottombrd_Button_LED2_On,  //给按键板LED2上电
        cmd_bottombrd_Button_LED2_Off, //给按键板LED2断电
        cmd_bottombrd_Button_LED3_On,  //给按键板LED3上电
        cmd_bottombrd_Button_LED3_Off, //给按键板LED3断电
        cmd_bottombrd_default = 0xFFFF,
    }BOTTOM_BOARD_CMD_TYPE;*/
    @StructField(order = 0)
    private short functionCode;

    @StructField(order = 1)
    private short functionValue;

    public short getFunctionCode() {
        return functionCode;
    }

    public void setFunctionCode(short functionCode) {
        this.functionCode = functionCode;
    }

    public short getFunctionValue() {
        return functionValue;
    }

    public void setFunctionValue(short functionValue) {
        this.functionValue = functionValue;
    }

//    ByteBuffer byteBuffer;
//
//    public BeanToBottomBoard(ByteBuffer byteBuffer) {
//        this.byteBuffer = byteBuffer;
//    }
//
//    public byte[] getCommand() {
//        return byteBuffer.array();
//    }

//    public static final class DataToBottomBoardBuilder {
//        private int address;
//        private short key;
//        private short value;
//
//        public DataToBottomBoardBuilder setKey(short key) {
//            this.key = key;return this;
//        }
//
//        public DataToBottomBoardBuilder setValue(short value)  {
//            this.value = value;return this;
//        }
//
//
//        public DataToBottomBoardBuilder setAddress(int address) {
//            this.address = address;return this;
//        }
//
//        public BeanToBottomBoard build(){
//            ByteBuffer byteBuffer = ByteBuffer.allocate(80).order(ByteOrder.LITTLE_ENDIAN);
//            byteBuffer.putInt(address);
//            byteBuffer.position(10);
//            byteBuffer.put((byte) 0x40);
//
//            ByteBuffer content = ByteBuffer.allocate(64).order(ByteOrder.LITTLE_ENDIAN);
//            content.putShort(key);
//            content.putShort(value);
//            content.flip();//将content设置为读模式，才能写入byteBuffer,如果没写这句，用content.array()
////            Log.e("12121","发往能量板: "+ ByteUtil.ByteArrToHex(content.array()));
//            byteBuffer.put(content);
//
//            byteBuffer.position(75);
//            byteBuffer.put((byte)0x01);
//            byteBuffer.put((byte)0x01);
//            return new BeanToBottomBoard(byteBuffer);
//        }
//    }
}
